package io.renren.common.jackson;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * 针对map的处理
 *
 * @author 40659
 * @since 2025/2/14 13:39
 */
public class NullMapJsonSerializer extends JsonSerializer<Object> {

    /**
     * 声明为单例模式
     */
    public static final NullMapJsonSerializer INSTANCE = new NullMapJsonSerializer();

    @Override
    public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartObject();
        gen.writeEndObject();
    }
}
